package com.liu.response;

/**
 * 返回结果包装
 */
public class Result {

    private String status;

    private Object data;

    //定义一个通用的创建方法
    public static Result create(Object result) {
        return Result.create(result, "success");
    }

    public static Result success() {
        return Result.create(null, "success");
    }

    public static Result fail() {
        return Result.create(null, "fail");
    }

    public static Result create(Object data, String status) {
        Result result = new Result();
        result.setStatus(status);
        result.setData(data);
        return result;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}
